<div class="lian_fen chantu layui-hide">
    <div class="men">
        <div class="xiaotit">资金余额</div>
        <div class="fen1 float-l wd50">
            <div class="ffmg" style="margin: 140px auto 0">
                <div class="fftt1 fw700">资金余额</div>
                <div class="fftt2 fw700" id="lian_fen_balancefee">0</div>
                <div class="fftt3">收入合计-支出合计-费用扣收</div>
            </div>
        </div>
        <div class="fen2 float-l wd50">
            <div>
                <span class="float-l" style="padding-left: 59px;padding-bottom: 5px;font-weight: 700;">项目收入构成：</span>
                <span class="float-r" style="font-weight: 700;">合计收入：<span id="lian_fen_lianyingshoufee">0</span></span>
            </div>
            <div class="clear"></div>
            <div class="chart" id="lian_chart_shougou" style="height: 40px"></div>
            <div>
                    <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                        <span class="fanglan tuclr1"></span><span style="margin-left: 20px">工程回款：<span id="lian_fen_shougonghuifee">0</span></span>
                    </span>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                        <span class="fanglv tuclr2"></span><span style="margin-left: 20px">联营方备用金：<span id="lian_fen_shoulianbeifee">0</span></span>
                    </span>
            </div>
            <div class="clear"></div>

            <div>
                <span class="float-l" style="padding-left: 59px;padding-bottom: 5px;font-weight: 700;margin-top: 30px">项目支出构成：</span>
                <span class="float-r" style="font-weight: 700;">合计支出：<span id="lian_fen_ziyingzhifee">0</span></span>
            </div>
            <div class="clear"></div>
            <div class="chart" id="lian_chart_zhigou" style="height: 40px"></div>
            <div>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglan tuclr3"></span><span style="margin-left: 20px">项目付款：<span id="lian_fen_zhixiangfee">0</span></span>
                </span>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglv tuclr4"></span><span style="margin-left: 20px">联营结算支付：<span id="lian_fen_zhilianjiefee">0</span></span>
                </span>
            </div>
            <div class="clear"></div>

            <div>
                <span class="float-l" style="padding-left: 59px;padding-bottom: 5px;font-weight: 700;margin-top: 30px">费用扣收构成：</span>
                <span class="float-r" style="font-weight: 700;">合计扣收：<span id="lian_fen_kou_allfee">0</span></span>
            </div>
            <div class="clear"></div>
            <div class="chart" id="lian_chart_kougou" style="height: 40px"></div>
            <div>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglan tuclr5"></span><span style="margin-left: 20px">管理费：<span id="lian_fen_kou_guanfee">0</span></span>
                </span>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglv tuclr6"></span><span style="margin-left: 20px">税费：<span id="lian_fen_kou_shuifee">0</span></span>
                </span>
                <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglv tuclr7"></span><span style="margin-left: 20px">其他费：<span id="lian_fen_kou_qifee">0</span></span>
                </span>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="fen3" style="margin-top: 20px">
            <div>
                <div class="float-l fw700">月度收支趋势</div>
                <div class="yuequ layui-form float-r fw700">
                    <input type="text" id="yuedushouzhimonth" placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="clear"></div>
            <div class="chart" id="lian_chart_yuexianshouzhi" style="height: 350px"></div>
        </div>
        <div style="padding-left: 150px">
                <span class="float-l fangding" style="padding-top: 5px;">
                    <span class="fanglan tuclr1"></span><span style="margin-left: 20px">收入</span>
                </span>
            <span class="float-l fangding" style="padding-left: 59px;padding-top: 5px;">
                    <span class="fanglv tuclr2"></span><span style="margin-left: 20px">支出</span>
                </span>
        </div>
        <div class="clear" style="padding-top: 30px"></div>
    </div>

    <div class="xiaoxian"></div>
    <div class="men">
        <div class="xiaotit">项目保证金</div>
        <div style="width: 900px;margin: 0 auto">
            <div class="float-l" style="width: 600px">
                <div class="chart" id="lian_chart_bondgou" style="height: 200px"></div>
            </div>
            <div class="float-l" style="padding-top: 40px;width: 300px">
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr1"></span><span style="margin-left: 20px">收取金额：<span id="lian_fen_bondshoufee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr2"></span><span style="margin-left: 20px">缴纳金额：<span id="lian_fen_bondjiaofee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr3"></span><span style="margin-left: 20px">退回金额：<span id="lian_fen_bondtuifee">0</span></span>
                </div><div class="clear"></div>
                <div class="float-l fangding" style="padding-left: 20px;padding-top: 5px;">
                    <span class="fanglan tuclr4"></span><span style="margin-left: 20px">返还金额：<span id="lian_fen_bondfanfee">0</span></span>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>

</div>
<script>

    layui.use(['laytp', 'form', 'laydate'], function() {
        var form = layui.form, layer = layui.layer, laydate = layui.laydate;
        var date = new Date();
        var year = date.getFullYear();
        lay('#yuedushouzhimonth').each(function(){
            var date = new Date();
            laydate.render({
                elem: this
                ,type: 'month'
                ,range: true
                ,value: year+'-01 - '+year+'-12'
                ,done: function(value, date, endDate){
                    var thisObj = $(this)[0].elem;
                    setTimeout(function () {
                        dataLayerAfterSea(thisObj);
                    },200)
                    setTimeout(function () {
                        func_lian_fen('yuedu');
                    },200)
                }
            });
        });
    });


    function func_lian_fen(seatype='') {
        var yuedushouzhimonth = $("#yuedushouzhimonth").val() || '';
        facade.ajax({url: ask_engin_cha_lian_fen,data:{enginid:param_enginid,yuedushouzhimonth:yuedushouzhimonth}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data;

                lian_chart_yuexianshouzhi('lian_chart_yuexianshouzhi', data);
                if(seatype == 'yuedu'){
                    return false;
                }


                $("#lian_fen_balancefee").html(parseFormatNum(data.balancefee));
                $("#lian_fen_lianyingshoufee").html(parseFormatNum(data.lianyingshoufee));
                $("#lian_fen_shougonghuifee").html(parseFormatNum(data.shougonghuifee)).addClass('colorlan').click(function () {
                    openNavPage('查看项目收款信息','shou_xiang/index.php?status=1&feilei_option=xmsr_gchk&enginid='+data.id);
                });
                $("#lian_fen_shoulianbeifee").html(parseFormatNum(data.shoulianbeifee)).addClass('colorlan').click(function () {
                    openNavPage('查看项目收款信息','shou_xiang/index.php?status=1&feilei_option=xmsr_lyfbyj&enginid='+data.id);
                });
                lian_chart_shougou('lian_chart_shougou', data);

                $("#lian_fen_ziyingzhifee").html(parseFormatNum(data.ziyingzhifee));
                $("#lian_fen_zhixiangfee").html(parseFormatNum(data.zhixiangfee)).addClass('colorlan').click(function () {
                    openNavPage('查看项目付款信息','zhi_xiang/index.php?status=1&enginid='+data.id);
                });
                $("#lian_fen_zhilianjiefee").html(parseFormatNum(data.zhilianjiefee)).addClass('colorlan').click(function () {
                    openNavPage('查看联营结算信息','zhi_lianjie/index.php?status=1&enginid='+data.id);
                });
                lian_chart_zhigou('lian_chart_zhigou', data);


                $("#lian_fen_kou_allfee").html(parseFormatNum(data.kou_allfee));
                $("#lian_fen_kou_guanfee").text(parseFormatNum(data.kou_guanfee)).addClass('colorlan').click(function () {
                    openNavPage('查看费用扣收信息','lian_koulan/index.php?status=1&feitype_option=xmsr_lyfyhks_glf&enginid='+data.id);
                });
                $("#lian_fen_kou_shuifee").text(parseFormatNum(data.kou_shuifee)).addClass('colorlan').click(function () {
                    openNavPage('查看费用扣收信息','lian_koulan/index.php?status=1&feitype_option=xmsr_lyfyhks_sf&enginid='+data.id);
                });
                $("#lian_fen_kou_qifee").text(parseFormatNum(data.kou_qifee)).addClass('colorlan').click(function () {
                    openNavPage('查看费用扣收信息','lian_koulan/index.php?status=1&feitype_option=noguannoshui&enginid='+data.id);
                });
                lian_chart_kougou('lian_chart_kougou', data);


                $("#lian_fen_bondshoufee").text(parseFormatNum(data.bondshoufee)).addClass('colorlan').click(function () {
                    openNavPage('查看保证金收取信息','bond_shou/index.php?status=1&enginid='+data.id);
                });
                $("#lian_fen_bondjiaofee").text(parseFormatNum(data.bondjiaofee)).addClass('colorlan').click(function () {
                    openNavPage('查看保证金缴纳信息','bond_jiao/index.php?status=1&enginid='+data.id);
                });
                $("#lian_fen_bondtuifee").text(parseFormatNum(data.bondtuifee)).addClass('colorlan').click(function () {
                    openNavPage('查看保证金退回信息','bond_tui/index.php?status=1&enginid='+data.id);
                });
                $("#lian_fen_bondfanfee").text(parseFormatNum(data.bondfanfee)).addClass('colorlan').click(function () {
                    openNavPage('查看保证金返还信息','bond_fan/index.php?status=1&enginid='+data.id);
                });
                lian_chart_bondgou('lian_chart_bondgou', data);

            }
        });
    }



    function lian_chart_shougou(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            tooltip: {},
            color: [colors[1], colors[2]],
            backgroundColor: '#FFFFFF',
            grid: {
                top: '-44px',
                bottom: '-56px',
                left: '50px',
                right: '1px',
                containLabel: true
            },
            xAxis: {
                type: ''
            },
            yAxis: {
                type: '',
                data: ['']
            },
            series: [
                {
                    name: '工程回款',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.shougonghuifee]
                },
                {
                    name: '联营方备用金',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.shoulianbeifee]
                }
            ]
        };
        mychat.setOption(option);
    }
    function lian_chart_zhigou(chat_id,data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            tooltip: {},
            color: [colors[3], colors[4]],
            backgroundColor: '#FFFFFF',
            grid: {
                top: '-44px',
                bottom: '-56px',
                left: '50px',
                right: '1px',
                containLabel: true
            },
            xAxis: {
                type: ''
            },
            yAxis: {
                type: '',
                data: ['']
            },
            series: [
                {
                    name: '项目付款',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.zhixiangfee]
                },
                {
                    name: '联营结算支付',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.zhilianjiefee]
                }
            ]
        };
        mychat.setOption(option);
    }
    function lian_chart_kougou(chat_id,data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            tooltip: {},
            color: [colors[5], colors[6], colors[7]],
            backgroundColor: '#FFFFFF',
            grid: {
                top: '-44px',
                bottom: '-56px',
                left: '50px',
                right: '1px',
                containLabel: true
            },
            xAxis: {
                type: ''
            },
            yAxis: {
                type: '',
                data: ['']
            },
            series: [
                {
                    name: '管理费',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.kou_guanfee]
                },
                {
                    name: '税费',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.kou_shuifee]
                },
                {
                    name: '其他费',
                    type: 'bar',
                    stack: 'total',
                    label: {
                        show: true
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [data.kou_qifee]
                }
            ]
        };
        mychat.setOption(option);
    }
    function lian_chart_yuexianshouzhi(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: [colors[1], colors[2]],
            backgroundColor: '#FFFFFF',
            legend: {},
            tooltip: {},
            grid: {
                top: '15px',
                bottom: '1px',
                left: '1',
                right: '1',
                containLabel: true
            },
            dataset: {
                source: data.yuexianshouzhi
            },
            xAxis: { type: 'category' },
            yAxis: { name:'' },
            series: [{ type: 'bar' }, { type: 'bar' }]
        };
        mychat.setOption(option);
    }
    function lian_chart_bondgou(chat_id, data) {
        var mychat = echarts.init(document.getElementById(chat_id), 'dark');
        mychat.clear();
        option = {
            color: [colors[1], colors[2], colors[3], colors[4]],
            backgroundColor: '#FFFFFF',
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '保证金',
                    type: 'pie',
                    radius: '80%',
                    data: [
                        { value: data.bondshoufee, name: '收取金额' },
                        { value: data.bondjiaofee, name: '缴纳金额' },
                        { value: data.bondtuifee, name: '退回金额' },
                        { value: data.bondfanfee, name: '返还金额' },
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                }
            ]
        };
        mychat.setOption(option);
    }


</script>

